package com.example.dllo.keepdemo.train.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.dllo.keepdemo.R;
import com.example.dllo.keepdemo.base.BaseActivity;

/**
 * Created by dllo on 16/1/19.
 */
public class PlanDetailActivity extends BaseActivity implements View.OnClickListener {
    private TextView tvContent,tvDifficulty,tvDifficultycon,tvTrainTime,tvTime,tvTrainrule,tvRule,tvSuitperson,tvPerson,tvOther,tvOtherthings;
    private ImageView imgBack;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_plandetail);
        imgBack = (ImageView) findViewById(R.id.img_activity_plan_detail_back);
        tvContent = (TextView) findViewById(R.id.tv_activity_plan_detail_content);
        tvDifficulty = (TextView) findViewById(R.id.tv_activity_plan_detail_difficulty);
        tvDifficultycon = (TextView) findViewById(R.id.tv_activity_plan_detail_difficultycon);
        tvTrainTime = (TextView) findViewById(R.id.tv_activity_plan_detail_traintime);
        tvTime = (TextView) findViewById(R.id.tv_activity_plan_detail_time);
        tvTrainrule = (TextView) findViewById(R.id.tv_activity_plan_detail_trainrule);
        tvRule = (TextView) findViewById(R.id.tv_activity_plan_detail_rule);
        tvSuitperson = (TextView) findViewById(R.id.tv_activity_plan_detail_suitperson);
        tvPerson = (TextView) findViewById(R.id.tv_activity_plan_detail_person);
        tvOther = (TextView) findViewById(R.id.tv_activity_plan_detail_other);
        tvOtherthings = (TextView) findViewById(R.id.tv_activity_plan_detail_otherthings);
        imgBack.setOnClickListener(this);

        initData();
    }

    private void initData() {
        Intent intent = getIntent();
        String details = intent.getStringExtra("detail");
        String[] str = details.split("####");
        tvContent.setText(str[0]);
        tvDifficulty.setText(str[1].substring(0,5));
        tvDifficultycon.setText(str[1].substring(5));
        tvTrainTime.setText(str[2].substring(0,5));
        tvTime.setText(str[2].substring(5));
        tvTrainrule.setText(str[3].substring(0,5));
        tvRule.setText(str[3].substring(5));
        tvSuitperson.setText(str[4].substring(0, 5));
        tvPerson.setText(str[4].substring(5));
        tvOther.setText(str[5].substring(0, 7));
        tvOtherthings.setText(str[5].substring(7));
    }

    @Override
    public void onClick(View v) {
        PlanDetailActivity.this.finish();
    }
}
